﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

namespace Dropit.BlogPageProvider.SpecializedProperties.PropertyControls
{
	class BlogProviderPropertyControl : EPiServer.Web.PropertyControls.PropertySelectControlBase
	{
		protected override void SetupEditControls()
		{
			foreach (string provider in BlogService.Instance.Providers)
			{
				base.EditControl.Items.Add(new ListItem(provider));
			}
			base.EditControl.Items.Insert(0, new ListItem("--- Select ---", ""));
			if (!this.IsNull)
			{
				string selectedValue = this.PropertyData.Value.ToString();
				ListItem listItem = this.EditControl.Items.FindByValue(selectedValue);
				if (listItem != null)
				{
					listItem.Selected = true;
				}
			}
			base.SetupEditControls();
		}
	}
}
